import request from '@/utils/request'

export const permissionAPI = () => request({ // 获取-权限点列表
  url: '/sys/permission',
  method: 'GET'
})

export const DelpermissionAPI = (id) => request({ // 删除-权限
  url: `/sys/permission/${id}`,
  method: 'DELETE'
})

export const addpermissionAPI = ({ name, code, description, type, pid, enVisible }) => request({ // 添加 - 权限
  url: '/sys/permission',
  method: 'POST',
  data: {
    name,
    code,
    description,
    type,
    pid,
    enVisible
  }
})

export const getpermissionAPI = (id) => request({ // 获取权限详情
  url: `/sys/permission/${id}`,
  method: 'GET'
})

export const setpermissionAPI = ({ _id, name, code, description, type, pid, enVisible, __v, id }) => request({ // 修改 - 权限
  url: `/sys/permission/${id}`,
  method: 'PUT',
  data: {
    _id,
    name,
    code,
    description,
    type,
    pid,
    enVisible,
    __v,
    id
  }
})
